using System;
using MetaBuilders.Irc;
using MetaBuilders.Irc.Messages;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace MetaBuilders.NeboTests {

	public abstract class MessageTester {
		
		public void AssertRoundTrip( String raw ) {
			IrcMessage msg = MessageParserService.Service.Parse( raw );
			Assert.IsNotNull( msg );
			Assert.AreEqual( raw, msg.ToString() );
		}

		public void AssertMessageType( String raw, Type expectedType ) {
			IrcMessage msg = MessageParserService.Service.Parse( raw );
			Assert.IsInstanceOfType( msg, expectedType );
		}

		public IrcMessage AssertRoundTripAndType( String raw, Type expectedType ) {
			IrcMessage msg = MessageParserService.Service.Parse( raw );
			Assert.IsNotNull( msg );
			Assert.IsInstanceOfType( msg, expectedType );
			Assert.AreEqual( raw, msg.ToString() );
			return msg;
		}

	}
}
